package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderSettingMapper {
    /**
     * 根据月份查询预约设置数据
     * @param startDate
     * @param endDate
     * @return
     */
    @Select("SELECT * FROM t_ordersetting WHERE orderDate BETWEEN #{startDate} AND #{endDate}")
    List<OrderSetting> getOrderSettingByMonth(LocalDate startDate, LocalDate endDate);

    /**
     * 设置每天可预约人数
     * @param orderSetting
     */
    void insertNumberByOrderDate(OrderSetting orderSetting);

    /**
     * 根据日期查询预约设置数据
     * @param orderSetting
     * @return
     */
    @Select("SELECT * FROM t_ordersetting WHERE orderDate = #{orderDate}")
    OrderSetting getByOrderDate(OrderSetting orderSetting);


    /**
     * 根据日期修改预约设置数据
     * @param orderSetting
     */
    void updateByOrderDate(OrderSetting orderSetting);
}
